﻿using DotNetty.Buffers;
using QQ.Codecs;
using static QQ.Codecs.DotNettyByteBufferExtensions.LengthType;

namespace QQ.Packet.Request.TLV
{
    public class TLV0x2 : IRequest
    {
        private short sigVer { get; set; } = 0;
        public string captchaCode { get; set; }
        public IByteBuffer captchaToken { get; set; }
        public IByteBuffer Serialize() => Unpooled.Buffer()
            .WriteShort(sigVer)
            .WriteBytesWithLength(captchaToken.ToArray().ToByteBuffer(), SHORT)
            .WriteBytesWithLength(captchaToken, SHORT);
    }
}
